#ifndef GENETIC_TRAINING_H
#define GENETIC_TRAINING_H

#include "Constants.h"
#include "ArtificialNeuralNetwork.h"
#include "DatasetReader.h"
#include <vector>





class GeneticTraining{

public:
	GeneticTraining(int numOfLayers , int* neuronsNum ,int MaxPopulation = MAX_POPULATION_SIZE, 
					float mutRate = MUTATION_RATE, float crossRate = CROSSOVER_RATE	);

	~GeneticTraining();

	void		initializePopulation();
	Chromosome		mutate(int);
	Chromosome		crossover(Chromosome,Chromosome);
	Chromosome		select(Chromosome,Chromosome);	

	/*void		mutate(void);
	void		crossover(void);
	void		select(void);*/	

	void		calculateAllFitnessOfPopulation();	
	void		release();
	void		cycle();
	void		printFitness();
	void		printPopulation();
	double		getMinFitness();
	double		getFitness(Chromosome individual);
	Chromosome	newIndividual();
	void		setANNweightsWithBestChromosome();
	double*		getANNresult(double*);

	Chromosome		*mChromosomes;		//population  - solution space
	int				bestIndividual;
	Chromosome      bestChromosome;
	double			*mFitnessValues;
	int				mPopulationSize;
	float			mfMutationRate;
	float			mfCrossoverRate;
	int				mLayerNum;
	int				*mNeuronNum;
	int				mWeightConNum;    //number of weight connections between neurons
	int				mGenerationNumber;
	int				mActualSize;
	int				mSelectedSize;

	//
	ArtificialNeuralNetwork* ann;
	double* trainInput;
	double* desiredOutput;
	

	vector<DataPair<double>> datasets;
	
	

};

#endif